package com.nbsaas.boot.wms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "库存", model = "库存")
@Entity
@Table(name = "bs_inventory")
@Comment("库存表")
public class Inventory extends AbstractEntity {

    @Comment("商品ID")
    @FormField(title = "商品ID", sortNum = "1", grid = true, required = true)
    private Long productId;

    @Comment("SKU ID")
    @FormField(title = "SKU ID", sortNum = "2", grid = true, required = true)
    private Long skuId;

    @Comment("仓库ID")
    @FormField(title = "仓库ID", sortNum = "3", grid = true, required = true)
    private Long warehouseId;

    @Comment("货位ID")
    @FormField(title = "货位ID", sortNum = "4", grid = true)
    private Long locationId;

    @Comment("库存数量")
    @FormField(title = "库存数量", sortNum = "5", grid = true, type = InputType.el_input_number, sort = true)
    private Integer quantity;

    @Comment("可用库存")
    @FormField(title = "可用库存", sortNum = "6", grid = true, type = InputType.el_input_number, sort = true)
    private Integer availableQuantity;

    @Comment("锁定库存")
    @FormField(title = "锁定库存", sortNum = "7", grid = true, type = InputType.el_input_number, sort = true)
    private Integer lockedQuantity;

    @Comment("预警库存")
    @FormField(title = "预警库存", sortNum = "8", grid = true, type = InputType.el_input_number)
    private Integer warningQuantity;

    @Comment("最大库存")
    @FormField(title = "最大库存", sortNum = "9", grid = true, type = InputType.el_input_number)
    private Integer maxQuantity;

    @Comment("单位成本")
    @FormField(title = "单位成本", sortNum = "10", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal unitCost;

    @Comment("总成本")
    @FormField(title = "总成本", sortNum = "11", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal totalCost;

    @Comment("批次号")
    @FormField(title = "批次号", sortNum = "12", grid = true)
    @Column(length = 100)
    private String batchNo;

    @Comment("生产日期")
    @FormField(title = "生产日期", sortNum = "13", grid = true, type = InputType.date)
    private Date productionDate;

    @Comment("过期日期")
    @FormField(title = "过期日期", sortNum = "14", grid = true, type = InputType.date)
    private Date expiryDate;

    @Comment("库存状态")
    @FormField(title = "库存状态", sortNum = "15", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // NORMAL-正常, WARNING-预警, EXPIRED-过期, DAMAGED-损坏

    @Comment("备注")
    @FormField(title = "备注", sortNum = "16", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;
} 